import rtconfig
from building import *

# get current directory
cwd = GetCurrentDir()

# The set of source files associated with this SConscript file.

src = Split('''
CMSIS/Device/Maxim/MAX32660/Source/system_max32660.c
Source/gpio.c
Source/lp.c
Source/tmr.c
Source/tmr_utils.c
Source/rtc.c
Source/icc.c
Source/mxc_lock.c
Source/mxc_assert.c
Source/mxc_delay.c
Source/mxc_pins.c
Source/mxc_sys.c
Source/nvic_table.c
''')
  
if GetDepend(['RT_USING_SERIAL']):
    src += ['Source/uart.c']
    
if GetDepend(['RT_USING_I2C']):
    src += ['Source/i2c.c']

if GetDepend(['RT_USING_SPI']):
    src += ['Source/spi.c']
    src += ['Source/spi17y.c']
    src += ['Source/spimss.c']


if GetDepend(['RT_USING_RTC']):
    src += ['Source/rtc.c']

if GetDepend(['RT_USING_WDT']):
    src += ['Source/wdt.c']

path = [cwd + '/CMSIS/Device/Maxim/MAX32660/Include',
    cwd + '/CMSIS/Core/Include',
    cwd + '/Include']

CPPDEFINES = ['TARGET=32660']
CPPDEFINES += ['TARGET_REV=0x4131']


group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)

Return('group')
